package com.ysd.lis.controller.lab;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.lab.LabMaininfo;
import com.ysd.lis.request.BacGenerateReportRequestParam;
import com.ysd.lis.service.lab.LabRptmainService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 检验报告记录 前端控制器
 * </p>
 *
 * @author Cfz
 * @since 2023-12-26
 */
@RestController
@RequestMapping("/api/lab/lab-rptmain")
public class LabRptmainController extends BaseController {
    @Autowired
    LabRptmainService labRptmainService;

    @ApiOperation("分页查询检验主记录")
    @PostMapping("/bacGenerateReport")
    public Result BacGenerateReport(@RequestBody BacGenerateReportRequestParam input) throws JsonProcessingException {
        return labRptmainService.BacGenerateReport(input);
    }

    @ApiOperation("预览/打印初级报告")
    @PostMapping("/bacGenerateFirstReport")
    public Result BacGenerateFirstReport(@RequestBody BacGenerateReportRequestParam input) {
        return labRptmainService.BacGenerateFirstReport(input);
    }

    @ApiOperation("预览/打印二级报告")
    @PostMapping("/bacGenerateSecondReport")
    public Result BacGenerateSecondReport(@RequestBody BacGenerateReportRequestParam input) {
        return labRptmainService.BacGenerateSecondReport(input);
    }

    @ApiOperation("自动生成报告")
    @PostMapping("/generateRptmainAutoAsync")
    public Result GenerateRptmainAutoAsync() {
        return labRptmainService.GenerateRptmainAutoAsync();
    }

    @ApiOperation("更换报告单重新生成报告-原有报告单删除")
    @PostMapping("/ReGenerateRptmain")
    public Result ReGenerateRptmain() {
        return labRptmainService.ReGenerateRptmain();
    }

    @ApiOperation("接口平台生成报告")
    @PostMapping("/lisGenerateRptmainAutoAsync")
    public void lisGenerateRptmainAutoAsync(@RequestBody LabMaininfo labMaininfo) {
        labRptmainService.LisGenerateRptmainAutoAsync(labMaininfo);
    }

    @ApiOperation("微生物重打标签")
    @GetMapping("/RePrintLabel")
    public Result RePrintLabel(String sltWorkFlowNo) {
        return labRptmainService.RePrintLabel(sltWorkFlowNo);
    }
}
